home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / update~4.z / update~4 / lib_stdio_setbuf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  851 b   |  34 lines

  1. /*                s e t b u f
  2.  *
  3.  * This function causes the specified buffer to be used for IO buffering
  4.  * instead of an automatically allocated buffer. It is called immediately
  5.  * after the stream has been opened, but before it is read from or
  6.  * written to. It is legal to call setbuf after making the stream
  7.  * unbuffered.
  8.  *
  9.  * If buf if NULL, IO will be unbuffered, otherwise it will be fully
  10.  * buffered. The manifest constant BUFSIZ in <stdio.h> tells how
  11.  * big an array is needed. Line buffering will be initiated if the
  12.  * output stream is directed to a terminal.
  13.  *
  14.  * Patchlevel 1.0
  15.  *
  16.  * Edit History:
  17.  */
  18.  
  19. #include "stdiolib.h"
  20.  
  21. /*LINTLIBRARY*/
  22.  
  23. void setbuf(fp, buf)
  24.  
  25. FILE *fp;                /* stream */
  26. char *buf;                /* buffer */
  27.  
  28. {
  29.   if (buf != NULL)
  30.     (void) setvbuf(fp, buf, _IOFBF, BUFSIZ);
  31.   else
  32.     (void) setvbuf(fp, (char *) NULL, _IONBF, 0);
  33. }
  34.